Method and device for encoding/decoding image

ABSTRACT

A device for encoding/decoding the image according to the present invention includes an intra prediction module configured to: determine an intra prediction mode of a current block; determine a scanning order of multiple sub blocks in the current block on the basis of the determined intra prediction mode; and perform intra prediction of the current block on the basis of the determined scanning order.

TECHNICAL FIELD

The present invention relates to a method and device forencoding/decoding a video signal.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra-high definition (UHD) images haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image compression techniques may beutilized.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; an entropy encoding technique of assigning a short code to avalue with a high appearance frequency and assigning a long code to avalue with a low appearance frequency; and the like. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In the meantime, in addition to demands for high-resolution images,demands for stereographic image content, which is a new image service,have also increased. A video compression technique for effectivelyproviding stereographic image content with high resolution andultra-high resolution is being discussed.

DISCLOSURE Technical Problem

The present invention is intended to enhance compression efficiency ininter prediction.

The present invention is intended to enhance compression efficiency inintra prediction.

However, the technical problems to be solved by the embodiments are notlimited to the aforementioned technical problems and other technicalproblems may present.

Technical Solution

The present invention provides an inter prediction method and devicebased on a current picture reference mode.

The present invention provides a method and device for deriving a motionvector for a current picture reference mode.

The present invention provides a method and device for determiningencoding/decoding order of sub blocks belonging to a current block bytaking an intra prediction mode of the current block into consideration.

The present invention provides a method and device for generating areference sample for intra prediction on the basis of an interpolationfilter.

The present invention provides a method and device for determining aninterpolation filter being applied to a nearby sample by taking at leastone among a block size and an intra prediction mode into consideration.

Advantageous Effects

According to the present invention, efficiency of inter prediction maybe enhanced on the basis of the current picture reference mode.

Also, according to the present invention, the motion vector for thecurrent picture reference mode may be effectively derived.

Also, according to the present invention, efficiency of intra predictionmay be enhanced on the basis of adaptive encoding/decoding order.

Also, according to the present invention, the reference sample for intraprediction may be effectively generated by determining the optimuminterpolation filter and using the determined interpolation filter.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a device for encoding an imageaccording to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a device for decoding an imageaccording to an embodiment of the present invention.

FIG. 3 is a diagram illustrating intra prediction based on a fixedscanning order according to an embodiment of the present invention.

FIG. 4 is a diagram illustrating an intra prediction method based on anadaptive scanning order according to an embodiment of the presentinvention.

FIG. 5 is a diagram illustrating an example of a category related to ascanning order according to an embodiment of the present invention.

FIG. 6 is a diagram illustrating a process of intra prediction based onz scanning among adaptive scanning orders according to an embodiment ofthe present invention.

FIG. 7 is a diagram illustrating a process of intra prediction based onz scanning in the form of being rotated by an angle of 90 degrees in acounterclockwise direction among adaptive scanning orders according toan embodiment of the present invention.

FIG. 8 is a diagram illustrating a process of intra prediction based onz scanning in the form of being rotated by an angle of 90 degrees in aclockwise direction among adaptive scanning orders according to anembodiment of the present invention.

FIG. 9 is a diagram illustrating an inter prediction method based on acurrent picture reference mode according to an embodiment of the presentinvention.

FIG. 10 is a diagram illustrating a method of deriving a motion vectorof a current block encoded in a current picture reference mode accordingto an embodiment of the present invention.

FIG. 11 is a diagram illustrating a method of filtering a referenceblock according to an embodiment of the present invention.

FIG. 12 is a diagram illustrating a shape of a current block encoded ina current picture reference mode according to an embodiment of thepresent invention.

FIG. 13 is a diagram illustrating a process of intra prediction based oninterpolation according to an embodiment of the present invention.

FIG. 14 is a diagram illustrating a method of applying an interpolationfilter according to an embodiment of the present invention.

FIG. 15 is a diagram illustrating an example of an interpolation filterusing multiple taps according to an embodiment of the present invention.

BEST MODE

In an intra prediction method according to the present invention, anintra prediction mode of a current block may be determined, a scanningorder of multiple sub blocks in the current block may be determined onthe basis of the determined intra prediction mode, and intra predictionof the current block may be performed on the basis of the determinedscanning order.

In an inter prediction method according to the present invention, amotion vector of a current block may be derived, a reference block ofthe current block may be determined on the basis of the motion vector ofthe current block, and motion compensation of the current block may beperformed on the basis of the determined reference block, wherein thereference block may belong to the same picture as the current block.

In an intra prediction method according to the present invention, anearby sample for intra prediction of a current block may be specified,predetermined filtering may be performed on the specified nearby sample,a reference sample for the intra prediction may be generated by applyingan interpolation filter to the filtered nearby sample, and the intraprediction of the current block may be performed on the basis of thegenerated reference sample.

In a device for encoding/decoding an image according to the presentinvention, included is an intra prediction module configured to:determine an intra prediction mode of a current block; determine ascanning order of multiple sub blocks in the current block on the basisof the determined intra prediction mode; and perform intra prediction ofthe current block on the basis of the determined scanning order.

In a device for encoding/decoding an image according to the presentinvention, included is an inter prediction module configured to: derivea motion vector of a current block; determine a reference block of thecurrent block on the basis of the motion vector of the current block;and perform motion compensation of the current block on the basis of thedetermined reference block, wherein the reference block may belong tothe same picture as the current block.

In a device for encoding/decoding an image according to the presentinvention, included is an intra prediction module configured to: specifya nearby sample for intra prediction of a current block; performpredetermined filtering on the specified nearby sample; generate areference sample for the intra prediction by applying an interpolationfilter on the filtered nearby sample; and perform the intra predictionof the current block on the basis of the generated reference sample.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, and theexemplary embodiments can be construed as including all modifications,equivalents, or substitutes in a technical concept and a technical scopeof the present invention. The similar reference numerals refer to thesimilar element in described the drawings.

Terms used in the specification, “first”, “second”, etc. can be used todescribe various elements, but the elements are not to be construed asbeing limited to the terms. The terms are only used to differentiate oneelement from other elements. For example, the “first” element may benamed the “second” element without departing from the scope of thepresent invention, and the “second” element may also be similarly namedthe “first” element. The term “and/or” includes a combination of aplurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing “connected to” or “coupled to” another element without being“directly connected to” or “directly coupled to” another element in thepresent description, it may be “directly connected to” or “directlycoupled to” another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded.

Hereinafter, preferred embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.Hereinafter, the same elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

FIG. 1 is a block diagram illustrating a device for encoding an imageaccording to an embodiment of the present invention.

Referring to FIG. 1, the device 100 for encoding an image may include: apicture division module 110, prediction modules 120 and 125, a transformmodule 130, a quantization module 135, a rearrangement module 160, anentropy encoding module 165, an inverse quantization module 140, aninverse transform module 145, a filter module 150, and a memory 155.

The constituents shown in FIG. 1 are independently shown so as torepresent characteristic functions different from each other in thedevice for encoding the image. Thus, it does not mean that eachconstituent is constituted in a constituent unit of segregated hardwareor software. In other words, each constituent includes each ofenumerated constituents for convenience. Thus, at least two constituentsof each constituent may be combined to form one constituent or oneconstituent may be divided into a plurality of constituents to performeach function. The embodiment where each constituent is combined and theembodiment where one constituent is divided are also included in thescope of the present invention, if not departing from the essence of thepresent invention.

Also, some of elements may not be indispensable elements performingessential functions of the present invention but be selective elementsimproving only performance thereof. The present invention may beimplemented by including only the indispensable constituents forimplementing the essence of the present invention except the elementsused in improving performance. The structure including only theindispensable elements except the selective elements used in improvingonly performance is also included in the scope of the present invention.

The picture division module 110 may divide an input image into one ormore blocks. Here, the block may mean a coding unit (CU), a predictionunit (PU), or a transform unit (TU). Division may be performed on thebasis of a quad tree or a binary tree or both. The quad tree is a methodof dividing an upper-layer block into four lower-layer blocks each ofwhich the width and the height are half of the upper-layer block. Thebinary tree is a method of dividing an upper-layer block into twolower-layer blocks each of which the width or the height is half of theupper-layer block. In the binary tree, through division based on thebinary tree, the block of which the height is half of the upper-layerblock may be in a square or non-square shape.

Hereinafter, in the embodiment of the present invention, the coding unitmay mean a unit performing encoding, or a unit performing decoding.

The prediction modules 120 and 125 may include an inter predictionmodule 120 performing inter prediction and an intra prediction module125 performing intra prediction. Whether to perform inter prediction orintra prediction for the prediction may be determined, and detailedinformation (for example, an intra prediction mode, a motion vector, areference picture, and the like) according to each prediction method maybe determined. Here, the processing unit subjected to prediction may bedifferent from the processing unit in which the prediction method andthe detailed content are determined. For example, the prediction method,the prediction mode, and the like may be determined by the predictionunit, and prediction may be performed by the transform unit. A residualvalue (residual block) between the generated prediction block and anoriginal block may be input to the transform module 130. Also,prediction mode information used for prediction, motion vectorinformation, and the like may be encoded with the residual value by theentropy encoding module 165 and may be transmitted to a device fordecoding. When a particular encoding mode is used, the original block isintactly encoded and transmitted to a decoding module without generatingthe prediction block by the prediction modules 120 and 125.

The inter prediction module 120 may predict the prediction unit on thebasis of information on at least one among a previous picture and asubsequent picture of the current picture, or may predict the predictionunit on the basis of information on some encoded regions in the currentpicture, in some cases. The inter prediction module 120 may include areference picture interpolation module, a motion prediction module, anda motion compensation module.

The reference picture interpolation module may receive reference pictureinformation from the memory 155 and may generate pixel information of aninteger pixel or less from the reference picture. In the case of lumapixels, an 8-tap DCT-based interpolation filter having differentcoefficients may be used to generate pixel information on an integerpixel or less on a per-¼ pixel basis. In the case of chroma signals, a4-tap DCT-based interpolation filter having different filtercoefficients may be used to generate pixel information on an integerpixel or less on a per-⅛ pixel basis.

The motion prediction module may perform motion prediction based on thereference picture interpolated by the reference picture interpolationmodule. As methods for calculating a motion vector, various methods,such as a full search-based block matching algorithm (FBMA), a threestep search (TSS) algorithm, a new three-step search (NTS) algorithm,and the like may be used. The motion vector may have a motion vectorvalue on a per-½ or -¼ pixel basis on the basis of the interpolatedpixel. The motion prediction module may predict a current predictionunit by changing the motion prediction method. As motion predictionmethods, various methods, such as a skip method, a merge method, anadvanced motion vector prediction (AMVP) method, and the like may beused.

The intra prediction module 125 may generate a prediction unit on thebasis of reference pixel information around a current block, which ispixel information in the current picture. When the nearby block of thecurrent prediction unit is a block subjected to inter prediction andthus a reference pixel is a pixel subjected to inter prediction,reference pixel information of a nearby block subjected to intraprediction is used instead of the reference pixel included in the blocksubjected to inter prediction. That is, when a reference pixel isunavailable, at least one reference pixel of available reference pixelsis used instead of unavailable reference pixel information.

Prediction modes in intra prediction may include a directionalprediction mode using reference pixel information depending on aprediction direction and a non-directional mode not using directionalinformation in performing prediction. A mode for predicting lumainformation may be different from a mode for predicting chromainformation, and in order to predict the chroma information, intraprediction mode information used to predict the luma information orpredicted luma signal information may be utilized.

In the intra prediction method, a prediction block may be generatedafter applying an adaptive intra smoothing (AIS) filter to a referencepixel depending on the prediction modes. The type of AIS filter appliedto the reference pixel may vary. In order to perform the intraprediction method, an intra prediction mode of the current predictionunit may be predicted from the intra prediction mode of the predictionunit around the current prediction unit. In predicting the predictionmode of the current prediction unit by using mode information predictedfrom the nearby prediction unit, when the intra prediction mode of thecurrent prediction unit is the same as the intra prediction mode of thenearby prediction unit, information indicating that the currentprediction unit and the nearby prediction unit have the same predictionmode is transmitted using predetermined flag information. When theprediction mode of the current prediction unit is different from theprediction mode of the nearby prediction unit, entropy encoding isperformed to encode prediction mode information of the current block.

Also, a residual block may be generated on the basis of prediction unitsgenerated by the prediction modules 120 and 125, wherein the residualblock includes information on a residual value which is a differencevalue between the prediction unit subjected to prediction and theoriginal block of the prediction unit. The generated residual block maybe input to the transform module 130.

The transform module 130 may transform the residual block includingresidual data by using a transform method, such as DCT, DST, and thelike. Here, the transform method may be determined on the basis of theintra prediction mode of the prediction unit which is used to generatethe residual block.

The quantization module 135 may quantize values transformed into afrequency domain by the transform module 130. Quantization coefficientsmay vary depending on a block or importance of an image. The valuescalculated by the quantization module 135 may be provided to the inversequantization module 140 and the rearrangement module 160.

The rearrangement module 160 may perform rearrangement of coefficientvalues with respect to quantized residual values.

The rearrangement module 160 may change a coefficient in the form of atwo-dimensional block into a coefficient in the form of aone-dimensional vector through a coefficient scanning method. Forexample, the rearrangement module 160 may scan from a DC coefficient toa coefficient in a high frequency domain using a predetermined scan typeso as to change the coefficients to be in the form of one-dimensionalvector.

The entropy encoding module 165 may perform entropy encoding based onthe values calculated by the rearrangement module 160. Entropy encodingmay use various encoding methods, for example, exponential Golombcoding, context-adaptive variable length coding (CAVLC), andcontext-adaptive binary arithmetic coding (CABAL).

The entropy encoding module 165 may encode a variety of information,such as residual value coefficient information and block typeinformation of the coding unit, prediction mode information, divisionunit information, prediction unit information, transmission unitinformation, motion vector information, reference frame information,block interpolation information, filtering information, and the likefrom the rearrangement module 160 and the prediction modules 120 and125.

The entropy encoding module 165 may entropy encode the coefficientvalues of the coding unit input from the rearrangement module 160.

The inverse quantization module 140 may inversely quantize the valuesquantized by the quantization module 135 and the inverse transformmodule 145 may inversely transform the values transformed by thetransform module 130. The residual value generated by the inversequantization module 140 and the inverse transform module 145 may becombined with the prediction unit predicted by a motion estimationmodule, a motion compensation unit, and the intra prediction module ofthe prediction modules 120 and 125 such that a reconstructed block canbe generated.

The filter module 150 may include at least one of a deblocking filter,an offset correction module, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion that occurs due toboundaries between the blocks in the reconstructed picture. In order todetermine whether to perform deblocking, whether to apply the deblockingfilter to the current block may be determined on the basis of the pixelsincluded in several rows and columns in the block. When the deblockingfilter is applied to the block, a strong filter or a weak filter isapplied depending on required deblocking filtering intensity. Also, inapplying the deblocking filter, when performing horizontal directionfiltering and vertical direction filtering, horizontal directionfiltering and vertical direction filtering are configured to beprocessed in parallel.

The offset correction module may correct an offset from the originalimage on a per-pixel basis with respect to the image subjected todeblocking. In order to perform offset correction on a particularpicture, used is a method of separating pixels of the image into thepredetermined number of regions, determining a region to be subjected tooffset, and applying the offset to the determined region or a method ofapplying an offset in consideration of edge information of each pixel.

Adaptive loop filtering (ALF) may be performed on the basis of the valueobtained by comparing the filtered reconstructed image and the originalimage. The pixels included in the image may be divided intopredetermined groups, a filter to be applied to each of the groups maybe determined, and filtering may be individually performed on eachgroup. Information on whether to apply ALF and a luma signal may betransmitted for each coding unit (CU). The form and filter coefficientof a filter for ALF to be applied may vary depending on each block.Also, the filter for ALF in the same form (fixed form) may be appliedregardless of the characteristic of the application target block.

The memory 155 may store the reconstructed block of the picturecalculated through the filter module 150. The stored reconstructed blockor picture may be provided to the prediction modules 120 and 125 inperforming inter prediction.

FIG. 2 is a block diagram illustrating a device for decoding an imageaccording to an embodiment of the present invention.

Referring to FIG. 2, a device 200 for decoding an image may include anentropy decoding module 210, a rearrangement module 215, an inversequantization module 220, an inverse transform module 225, predictionmodules 230 and 235, a filter module 240, and a memory 245.

When an image bitstream is input from the device for encoding the image,the input bitstream is decoded according to an inverse process of thedevice for encoding the image.

The entropy decoding module 210 may perform entropy decoding accordingto the inverse process of the entropy encoding by the entropy encodingmodule of the device for encoding the image. For example, correspondingto the methods performed by the device for encoding the image, variousmethods, such as exponential Golomb coding, context-adaptive variablelength coding (CAVLC), and context-adaptive binary arithmetic coding(CABAC) may be applied.

The entropy decoding module 210 may decode information on intraprediction and inter prediction performed by the device for encoding.

The rearrangement module 215 may perform rearrangement on the bitstreamentropy decoded by the entropy decoding module 210 on the basis of therearrangement method used in the device for encoding. The coefficientsexpressed in the form of the one-dimensional vector may be reconstructedand rearranged into the coefficients in the form of the two-dimensionalblock. The rearrangement module 215 may perform rearrangement through amethod of receiving information related to coefficient scanningperformed in the device for encoding and of inversely scanning on thebasis of the scanning order performed in the device for encoding.

The inverse quantization module 220 may perform inverse quantization onthe basis of a quantization parameter received from the device forencoding and the rearranged coefficient values of the block.

The inverse transform module 225 may perform inverse transform on thetransform coefficient subjected to inverse quantization using apredetermined transform method. Here, the transform method may bedetermined on the basis of information on the prediction method(inter/intra prediction), the size/shape of the block, the intraprediction mode, and the like.

The prediction modules 230 and 235 may generate a prediction block onthe basis of information on prediction block generation received fromthe entropy decoding module 210 and information on a previously decodedblock or picture received from the memory 245.

The prediction modules 230 and 235 may include a prediction unitdetermination module, an inter prediction module, and an intraprediction module. The prediction unit determination module may receivea variety of information, such as prediction unit information,prediction mode information of an intra prediction method, informationon motion prediction of an inter prediction method, and the like fromthe entropy decoding module 210, may separate a prediction unit in acurrent coding unit, and may determine whether inter prediction or intraprediction is performed on the prediction unit. By using informationrequired in inter prediction of the current prediction unit receivedfrom the device for encoding the image, the inter prediction module 230may perform inter prediction on the current prediction unit on the basisof information on at least one among a previous picture and a subsequentpicture of the current picture including the current prediction unit.Alternatively, inter prediction may be performed on the basis ofinformation on some pre-reconstructed regions in the current pictureincluding the current prediction unit.

In order to perform inter prediction, it may be determined which of askip mode, a merge mode, and an AMVP mode is used as the motionprediction method of the prediction unit included in the coding unit, onthe basis of the coding unit.

The intra prediction module 235 may generate a prediction block on thebasis of pixel information in the current picture. When the predictionunit is a prediction unit subjected to intra prediction, intraprediction is performed on the basis of intra prediction modeinformation of the prediction unit received from the device for encodingthe image. The intra prediction module 235 may include an adaptive intrasmoothing (AIS) filter, a reference pixel interpolation module, and a DCfilter. The AIS filter performs filtering on the reference pixel of thecurrent block, and whether to apply the filter may be determineddepending on the prediction mode of the current prediction unit. Theprediction mode of the prediction unit received from the device forencoding the image and AIS filter information are used in performing AISfiltering on the reference pixel of the current block. When theprediction mode of the current block is a mode in which AIS filtering isnot performed, the AIS filter is not applied.

When the prediction mode of the prediction unit is a prediction mode inwhich intra prediction is performed on the basis of the pixel valueobtained by interpolating the reference pixel, the reference pixelinterpolation module may interpolate the reference pixel to generate thereference pixel in units of a pixel of an integer value or less. Whenthe prediction mode of the current prediction unit is a prediction modein which a prediction block is generated without interpolating thereference pixel, the reference pixel is not interpolated. The DC filtermay generate a prediction block through filtering when the predictionmode of the current block is a DC mode.

The reconstructed block or picture may be provided to the filter module240. The filter module 240 may include the deblocking filter, the offsetcorrection module, and the ALF.

From the device for encoding the image, received is information onwhether the deblocking filter is applied to the relevant block orpicture and information on whether a strong filter or a weak filter isapplied when the deblocking filter is applied. The deblocking filter ofthe device for decoding the image may receive information on thedeblocking filter from the device for encoding the image, and the devicefor decoding the image may perform deblocking filtering on the relevantblock.

The offset correction module may perform offset correction on thereconstructed image on the basis of the type of offset correction,offset value information, and the like applied to the image inperforming encoding.

The ALF may be applied to the coding unit on the basis of information onwhether to apply the ALF, ALF coefficient information, and the likereceived from the device for encoding. The ALF information may beprovided as being included in a particular parameter set.

The memory 245 may store the reconstructed picture or block for use as areference picture or a reference block, and may provide thereconstructed picture to an output module.

Hereinafter, the intra prediction method will be described in detailwith reference to FIGS. 3 to 8. Intra prediction may be performed on thecurrent block using a predetermined intra prediction mode and areference sample. The current block may be determined through divisionbased on the tree structure (for example, the quad tree, and the binarytree). The current block may be the coding block (CU) or the predictionblock (PU).

The intra prediction may be performed on each of sub blocks that make upthe current block according to a predetermined scanning order. Thecurrent block may consist of one or more sub blocks. The current blockmay be defined as a set of sub blocks that share a single intraprediction mode.

The size/shape of the sub block may be pre-established and fixed in thedevice for encoding/decoding the image, or may be variably determineddepending on the size/shape of the current block or transform block.Alternatively, the device for encoding the image may encode informationindicating the size/shape of the sub block and may signal the result,and the device for decoding the image may determine the size/shape ofthe sub block on the basis of the signaled information.

The reference sample may be a neighboring sample of the current block(or the sub block). For example, the reference sample may belong to atleast one nearby block positioned on the left, the bottom left, the topleft, the top, or the top right of the current block (or the sub block).The reference sample may include a reference-possible sample for intraprediction of the current block (or the sub block) and/or a samplegenerated through a process of generating a predetermined referencesample.

The scanning order may be a pre-established, fixed scanning order(hereinafter, referred to as “a first method”) in the device forencoding/decoding the image, or may be an adaptive scanning order(hereinafter, referred to as “a second method”) based on the intraprediction mode of the current block. Either the first method or thesecond method may be used selectively. To this end, informationindicating whether the adaptive scanning order is used may be signaled.For example, when the information indicates a value of zero, the firstmethod is used, and when the information indicates a value of one, thesecond method is used. Alternatively, on the basis of at least one amongthe prediction mode of the current block, information on whether theintra prediction mode is in directionality, the directionality/angle ofthe intra prediction mode, the scanning type of the transformcoefficient, a transform technique, and the block size/shape, either thefirst method or the second method may be used selectively.

FIG. 3 is a diagram illustrating intra prediction based on a fixedscanning order according to an embodiment of the present invention.

In the embodiment, it is assumed that the fixed scanning order is zscanning and nearby samples in diagonal directions are referenced. Here,the nearby sample may include at least one among the reference-possibleor reference-impossible sample, and the sample generated through theprocess of generating the predetermined reference sample.

Referring to FIG. 3, the current block may consist of four sub blocks310, 320, 330, and 340. According to z scanning,prediction/reconstruction may be performed on a first sub block 310, asecond sub block 320, a third sub block 330, and a fourth sub block 340in this order.

The first sub block 310 may refer to a nearby sample 311 (a sampleindicated in oblique lines) reconstructed before the first sub block.

The second sub block 320 may be separated into a region of samplesindicated in white (hereinafter, referred to as “a first region”) and aregion of samples indicated in grayscale (hereinafter, referred to as “asecond region”). The first region is a region that refers to apre-reconstructed nearby sample 321 (a sample indicated in obliquelines), and the second region is a region that refers to anon-reconstructed or reference-impossible sample 322 (a sample filledwith dots). The sample in the second region has a low spatialcorrelation with the sample 322, which may result in performancedegradation of intra prediction.

Similarly, the third sub block 330 may be separated into a region ofsamples indicated in white (hereinafter, referred to as “a firstregion”) and a region of samples indicated in grayscale (hereinafter,referred to as “a second region”). The first region is a region thatrefers to a pre-reconstructed nearby sample 331 (a sample indicated inoblique lines), and the second region is a region that refers to anon-reconstructed or reference-impossible sample 332 (a sample filledwith dots). The sample in the second region has a low spatialcorrelation with the sample 332, which may result in performancedegradation of intra prediction.

Similarly, the fourth sub block 340 may be separated into a region ofsamples indicated in white (hereinafter, referred to as “a firstregion”) and a region of samples indicated in grayscale (hereinafter,referred to as “a second region”). The first region is a region thatrefers to a pre-reconstructed nearby sample 341 (a sample indicated inoblique lines), and the second region is a region that refers to anon-reconstructed or reference-impossible sample 342 (a sample filledwith dots). The sample in the second region has a low spatialcorrelation with the sample 342, which may result in performancedegradation of intra prediction.

FIG. 4 is a diagram illustrating an intra prediction method based on anadaptive scanning order according to an embodiment of the presentinvention.

Referring to FIG. 4, the intra prediction mode of the current block maybe determined at step S400.

Specifically, N intra prediction modes pre-defined in the device forencoding/decoding the image may be grouped into multiple groups. The Nmay be an integer equal to or greater than 35. For example, a firstgroup may consist of candidate modes (most probable mode, MPM), and asecond group may consist of modes except the candidate modes from the Nintra prediction modes. The candidate mode may be derived on the basisof at least one among the intra prediction mode of the nearby block anda default mode according to a rule pre-established in the device forencoding/decoding the image. The number of candidate modes may be three,four, five, six, or more.

The intra prediction mode of the current block may be determined usingin information specifying a group to which the intra prediction mode ofthe current block belongs and/or information specifying the intraprediction mode of the current block in the relevant group.

On the basis of the intra prediction mode determined at step S400, thescanning order in the current block may be determined at step S410.

The scanning order may be determined by taking whether the intraprediction mode is a non-directional mode or a directional mode intoconsideration. Alternatively, the scanning order may be determined bytaking the directionality/angle of the intra prediction mode intoconsideration. For example, a process of determining the scanning ordermay be implemented by a process of determining a category of the intraprediction mode by taking the directionality of the intra predictionmode into consideration, and by a process of determining the scanningorder on the basis of the determined category. The category may bedefined as a set of intra prediction modes with similar directionality.To this end, the N intra prediction modes pre-defined in the device forencoding/decoding the image may be classified into multiple categories.The device for encoding/decoding the image may define a mapping relationbetween a specific category and a scanning order.

On the basis of the scanning order determined at step S410, intraprediction of the current block may be performed at step S420. Accordingto the scanning order, the sub blocks of the current block may bepredicted/reconstructed in order. Prediction and reconstruction may beperformed on a prior sub block, and then prediction and reconstructionmay be performed on a posterior sub block. Here, the posterior sub blockmay refer to the nearby sample of the current block and/or thereconstruction sample of the prior sub block. In this way, the subblocks belonging to the current block may be predicted and reconstructedin order.

FIG. 5 is a diagram illustrating an example of a category related to ascanning order according to an embodiment of the present invention.

Scanning orders are classified into two, three, or more categoriesaccording to directionality of the intra prediction mode pre-defined inthe device for encoding/decoding the image. Alternatively, thecategories may be obtained by classification based on the number, range,and/or positions of samples referenced by the intra prediction mode ofthe current block.

The scanning order available for each category obtained byclassification may be defined. As the scanning orders, z scanning, zscanning in the form of being rotated by a predetermined angle in aclockwise/counterclockwise direction, and the like may be used. Thepredetermined angle may be an angle of 90 degrees, 180 degrees, −90degrees, or −180 degrees. For example, a first category may use zscanning, a second category may use z scanning in the form of beingrotated by an angle of 90 degrees in a counterclockwise direction, and athird category may use z scanning in the form of being rotated by anangle of 90 degrees in a clockwise direction.

The number/types of scanning orders may be variably determined by takingthe size of the block (for example, the coding block, the predictionblock, and the transform block), the division type of the block, thetransform type (for example, DCT, and DST), information on whether anon-zero transform coefficient is present, information on whether it isa transform skip block, a quantization parameter, and the like, intoconsideration. Alternatively, the number/types of scanning orders may bepreset in the device for encoding/decoding the image.

FIG. 6 is a diagram illustrating a process of intra prediction based onz scanning among adaptive scanning orders according to an embodiment ofthe present invention.

Referring to FIG. 6, according to directionality of the intra predictionmode, when referring to the top left nearby sample in a 135-degreedirection, intra prediction may be performed on the basis of z scanningamong the adaptive scanning orders. According to z scanning,prediction/reconstruction may be performed on a first sub block 610, asecond sub block 620, a third sub block 630, and a fourth sub block 640in this order.

The first sub block 610 may refer to a nearby sample 611 (a sampleindicated in oblique lines) reconstructed before the first sub block.

Nearby samples of the second sub block 620 may include apre-reconstructed nearby sample 621 (a sample indicated in obliquelines) and a non-reconstructed or reference-impossible sample 622 (asample filled with dots). However, the second sub block 620 may bepredicted/reconstructed with reference only to the pre-reconstructednearby sample 621 of these nearby samples.

Similarly, nearby samples of the third sub block 630 may include apre-reconstructed nearby sample 631 (a sample indicated in obliquelines) and a non-reconstructed or reference-impossible sample 632 (asample filled with dots). However, the third sub block 630 may bepredicted/reconstructed with reference only to the pre-reconstructednearby sample 631 of these nearby samples.

Similarly, nearby samples of the fourth sub block 640 include apre-reconstructed nearby sample 641 (a sample indicated in obliquelines) and a non-reconstructed or reference-impossible sample 642 (asample filled with dots). However, the fourth sub block 640 may bepredicted/reconstructed with reference only to the pre-reconstructednearby sample 641 of these nearby samples.

In the meantime, one sub block may be divided into two non-squareblocks. In this case, the scanning order for encoding/decoding the twonon-square blocks may be determined on the basis of directionality ofthe intra prediction mode of the current block.

As shown in FIG. 6, the first sub block 610 may be divided into a firstlower-layer block 612 and a second lower-layer block 613 that arenon-square blocks in a vertical direction. Here, when the intraprediction mode refers to the top left nearby sample in a 135-degreedirection, encoding/decoding is performed on the first lower-layer block612 and the second lower-layer block 613 in this order. After performingprediction and reconstruction on the first lower-layer block 612, andprediction and reconstruction may be performed on the second lower-layerblock 613. The second lower-layer block 613 may refer to at least oneamong the nearby sample of the first sub block 610 and thereconstruction sample of the first lower-layer block 612. Alternatively,after performing prediction on the first lower-layer block 612,prediction may be performed on the second lower-layer block 613. Here,the second lower-layer block 613 may refer to at least one among thenearby sample of the first sub block 610 and the prediction sample ofthe first lower-layer block 612.

Alternatively, as shown in FIG. 6, the third sub block 630 may bedivided into a third lower-layer block 633 and a fourth lower-layerblock 634 that are non-square blocks in a horizontal direction. Here,when the intra prediction mode refers to the top left nearby sample in a135-degree direction, encoding/decoding is performed on the thirdlower-layer block 633 and the fourth lower-layer block 634 in thisorder. Similarly, after performing prediction and reconstruction on thethird lower-layer block 633, prediction and reconstruction may beperformed on the fourth lower-layer block 634. The fourth upper-layerblock 634 may refer to at least one among the nearby sample of the thirdsub block 630 and the reconstruction sample of the third lower-layerblock 633. Alternatively, after performing prediction on the thirdlower-layer block 633, prediction may be performed on the fourthlower-layer block 634. Here, the fourth lower-layer block 634 may referto at least one among the nearby sample of the third sub block 630 andthe prediction sample of the third lower-layer block 633.

FIG. 7 is a diagram illustrating a process of intra prediction based onz scanning in the form of being rotated by an angle of 90 degrees in acounterclockwise direction among adaptive scanning orders according toan embodiment of the present invention.

Referring to FIG. 7, according to directionality of the intra predictionmode, when referring to the bottom left nearby sample in a 225-degreedirection, intra prediction may be performed on the basis of z scanningin the form of being rotated by an angle of 90 degrees in acounterclockwise direction among the adaptive scanning orders. Accordingto z scanning in the form of being rotated by an angle of 90 degrees ina counterclockwise direction, prediction/reconstruction may be performedon a first sub block 710, a second sub block 720, a third sub block 730,and a fourth sub block 740 in this order.

The first sub block 710 may be separated into a region of samplesindicated in white (hereinafter, referred to as “a first region”) and aregion of samples indicated in grayscale (hereinafter, referred to as “asecond region”). The first region is a region that refers to areference-possible or pre-reconstructed nearby sample 711 (a sampleindicated in oblique lines), and the second region is a region thatrefers to a non-reconstructed or reference-impossible sample 712 asample filled with dots). The sample of the region 712 may be generatedusing one or more samples belonging to the region 711. The sample of thesecond region may be predicted with reference to the generated sample ofthe region 712.

The second sub block 720 may be predicted/reconstructed with referenceto a pre-reconstructed nearby sample 721 (a sample indicated in obliquelines). Here, the pre-reconstructed nearby sample 721 may includereconstruction samples of the first sub block 710, which are adjacent tothe bottom of the second sub block.

The third sub block 730 may be separated into a region of samplesindicated in white (hereinafter, referred to as “a first region”) and aregion of samples indicated in grayscale (hereinafter, referred to as “asecond region”). The first region is a region that refers to areference-possible or pre-reconstructed nearby sample 731 (a sampleindicated in oblique lines), and the second region is a region thatrefers to a non-reconstructed or reference-impossible sample 732 (asample filled with dots). The sample of the region 732 may be generatedusing one or more samples belonging to the region 731. The sample of thesecond region may be predicted with reference to the generated sample ofthe region 732.

The fourth sub block 740 may be predicted/reconstructed with referenceto a pre-reconstructed nearby sample 741 (a sample indicated in obliquelines). Here, the pre-reconstructed nearby sample 741 may includereconstruction samples of the first sub block to the third sub block,which are adjacent to the fourth sub block.

As described above, according to directionality of the intra predictionmode, when using the adaptive scanning order, it is possible to minimizethe occurrence of the second region referring to a non-reconstructed orreference-impossible, such as the second sub block 720 and the fourthsub block 740.

In the meantime, one sub block may be divided into two non-squareblocks. In this case, the scanning order for encoding/decoding the twonon-square blocks may be determined on the basis of directionality ofthe intra prediction mode of the current block.

As shown in FIG. 7, the second sub block 720 may be divided into a firstlower-layer block 722 and a second lower-layer block 723 that arenon-square blocks in a horizontal direction. Here, when the intraprediction mode refers to the bottom left nearby sample in a 225-degreedirection, encoding/decoding may be performed on the first lower-layerblock 722 and the second lower-layer block 723 in this order.

After performing prediction and reconstruction on the first lower-layerblock 722, prediction and reconstruction may be performed on the secondlower-layer block 723. The second lower-layer block 723 may refer to atleast one among the nearby sample of the second sub block 720 and thereconstruction sample of the first lower-layer block 722. Alternatively,after performing prediction on the first lower-layer block 722,prediction may be performed on the second lower-layer block 723. Here,the second lower-layer block 723 may refer to at least one among thenearby sample of the second sub block 720 and the prediction sample ofthe first lower-layer block 722.

FIG. 8 is a diagram illustrating a process of intra prediction based onz scanning in the form of being rotated by an angle of 90 degrees in aclockwise direction among adaptive scanning orders according to anembodiment of the present invention.

Referring to FIG. 8, according to directionality of the intra predictionmode, when referring to the top right nearby sample in a 45-degreedirection, intra prediction may be performed on the basis of z scanningin the form of being rotated by an angle of 90 degrees in a clockwisedirection among the adaptive scanning orders. According to z scanning inthe form of being rotated by an angle of 90 degrees in a clockwisedirection, prediction/reconstruction may be performed on a first subblock 810, a second sub block 820, a third sub block 830, and a fourthsub block 840 in this order.

The first sub block 810 may be predicted/reconstructed with reference toa pre-reconstructed nearby sample 811 (a sample indicated in obliquelines).

The second sub block 820 may be separated into a region of samplesindicated in white (hereinafter, referred to as “a first region”) and aregion of samples indicated in grayscale (hereinafter, referred to as “asecond region”). The first region is a region that refers to areference-possible or pre-reconstructed nearby sample 821 (a sampleindicated in oblique lines), and the second region is a region thatrefers to a non-reconstructed or reference-impossible sample 822 (asample filled with dots). The sample of the region 822 may be generatedusing one or more samples belonging to the region 821. The sample of thesecond region may be predicted with reference to the generated sample ofthe region 822.

The third sub block 830 may be predicted/reconstructed with reference toa pre-reconstructed nearby sample 831 (a sample indicated in obliquelines). Here, the pre-reconstructed nearby sample 831 may includereconstruction samples of the first sub block 810 adjacent to the leftof the third sub block.

The fourth sub block 840 may be predicted/reconstructed with referenceto a pre-reconstructed nearby sample 841 (a sample indicated in obliquelines). Here, the pre-reconstructed nearby sample 841 may includereconstruction samples of the first sub block to the third sub blockadjacent to the fourth sub block.

As described above, according to directionality of the intra predictionmode, when using the adaptive scanning order, it is possible to minimizethe occurrence of the second region referring to a non-reconstructed orreference-impossible sample, such as the third sub block 830 and thefourth sub block 840.

In the meantime, one sub block may be divided into two non-squareblocks. In this case, the scanning order for encoding/decoding the twonon-square blocks may be determined on the basis of directionality ofthe intra prediction mode of the current block.

As shown in FIG. 8, the third sub block 830 may be divided into a firstlower-layer block 832 and a second lower-layer block 833 that arenon-square blocks in a vertical direction. Here, when the intraprediction mode refers to the top right nearby sample in a 45-degreedirection, encoding/decoding may be performed on the first lower-layerblock 832 and the second lower-layer block 833 in this order.

After performing prediction and reconstruction on the first lower-layerblock 832, prediction and reconstruction may be performed on the secondlower-layer block 833. The second lower-layer block 833 may refer to atleast one among the nearby sample of the third sub block 830 and thereconstruction sample of the first lower-layer block 832. Alternatively,after performing prediction on the first lower-layer block 832,prediction may be performed on the second lower-layer block 833. Here,the second lower-layer block 833 may refer to at least one among thenearby sample of the third sub block 830 and prediction sample of thefirst lower-layer block 832.

FIG. 9 is a diagram illustrating an inter prediction method based on acurrent picture reference mode according to an embodiment of the presentinvention.

In the current picture reference mode, motion compensation is performedon the current block on the basis of the reference block belonging tothe same picture as the current block. This may be segregated from theinter mode in which motion compensation is performed on the basis of areference block belonging to a picture different from the current block.For the segregation, information indicating whether the current block isa block encoded in the current picture reference mode may beencoded/decoded. Alternatively, when the picture specified by thereference picture index of the current block is the current picture, thecurrent block is determined as a block encoded in the current picturereference mode. The current picture is placed at a predeterminedposition within a reference picture list. The predetermined position maybe a position pre-established in the device for encoding/decoding theimage, or may be an arbitrary position like other reference pictures.For example, the current picture may be placed before a short-termreference picture, between the short-term reference picture and along-term reference picture, or after the long-term reference picture.

Referring to FIG. 9, on the basis of the motion vector of the currentblock, the reference block of the current block may be determined atstep S900.

When the current block is the block encoded in the current picturereference mode, the reference block is in the same picture as thecurrent block. In contrast, when the current block is encoded in theinter mode, the reference block is in a picture different from currentblock.

The motion vector may be derived from the nearby block of the currentblock. Here, the nearby block may mean a block spatially and/ortemporally adjacent to the current block. The spatially nearby block mayinclude at least one of blocks adjacent to the left, the top, the bottomleft, the top left, or the top right of the current block. Thetemporally nearby block may include at least one among a block in thesame position as the current block, and the block adjacent to the left,the top, the right, the bottom, or each corner of the block positionedin the same position.

The motion vector may be derived by selectively using the nearby blocksatisfying a predetermined condition among the nearby blocks. Examplesof the predetermined condition include whether the prediction mode (forexample, the current picture reference mode, the inter mode, and thelike) is the same as the current block, whether the same referencepicture list as the current block is used, whether the same referencepicture as the current block is referenced, and the like.

Alternatively, the motion vector may be determined on the basis oftemplate matching. The template matching is a process of specifying thenearby region (hereinafter, referred to as “a template”) of the currentblock and searching for a block having a most similar template to thetemplate of the current block. The search may be performed on the entireor a part of a pre-reconstructed region within the current picture, ormay be performed on a picture having a different time from the currentpicture.

Alternatively, the motion vector may be derived by taking the picturetype of the current picture, the frequency of the motion vectors for thecurrent picture reference mode, and the like into consideration, andthis will be described in detail with reference to FIG. 10.

Referring to FIG. 9, on the basis of the reference block determined atstep S900, motion compensation of the current block may be performed atstep S910.

The reference block may be a block consisting of integer pels or may bea block consisting of fraction pels. Alternatively, by performingpredetermined filtering on the reference block, a filtered referenceblock may be generated, and motion compensation may be performed usingthe filtered reference block. The filtering may be performed on thebasis of a weighted filter that changes a sample value of the referenceblock by applying a predetermined weighting factor to the sample value,or may be performed on the basis of an interpolation filter thatgenerates a fraction pel by interpolating the sample of the referenceblock.

The device for encoding the image may encode and signal filterinformation for filtering, and the device for decoding the image mayfilter the reference block on the basis of the signaled filterinformation.

The number of filters used in filtering may be one, two, three, or more.The filter may be a fixed coefficient filter pre-established in thedevice for encoding/decoding the image, or may be a variable coefficientfilter. The device for encoding the image may encode and signalinformation indicating whether the variable coefficient filter is used,and the device for decoding the image may determine whether the variablecoefficient filter is used, on the basis of the signaled information.The coefficient of the variable coefficient filter may be determined onthe basis of a coefficient signaled from the device for encoding theimage, or may be derived on the basis of one or more samples of thecurrent block and/or one or more samples of the nearby block.Alternatively, the coefficient of the variable coefficient filter may bederived from the coefficient of the filter used before the currentblock, or may be derived on the basis of a pre-defined coefficient at ahigh level, such as a sequence, a picture, and the like. The coefficientmay differ depending on the position of the sample being filtered.

Regarding precision of the fraction pel generated through the filtering,one of a ½ pel and ¼ pel may be selectively used. When the ½ pel isselected as the precision of the fraction pel, a ½ pel between twointeger pels is generated. When the ¼ pel is selected as the precisionof the fraction pel, a ¼ pel positioned between two integer pels isgenerated. The generated fraction pel may be generated using multiplesamples positioned on the same vertical line and/or horizontal link.Here, the multiple samples may include at least one among the integerpel and the pre-generated fraction pel. The selection may be performedon the basis of information encoded to specify the precision of thefraction pel. Alternatively, a precision pre-established in the devicefor encoding/decoding the image may be fixedly used. The above-describedprecision of the ½ pel and ¼ pel is just an example, expansion to a ⅛pel, a 1/16 pel, and the like is possible.

The process of motion compensation at step S910 may further include aprocess of scaling the reference block or rotating the reference blockby a predetermined angle. The scaling or rotating is to transform thereference block into the size/shape similar to the current block. Thismay be performed before or after the above-described filtering process.In the process of motion compensation at step S910, at least one amongthe filtering, scaling, and rotation may be omitted.

FIG. 10 is a diagram illustrating a method of deriving a motion vectorof a current block encoded in a current picture reference mode accordingto an embodiment of the present invention.

The motion vector of the current block encoded in the current picturereference mode may be derived from a predetermined motion candidatelist. This may be performed when the current block belongs to anintra-random access point (IRAP) picture.

The motion candidate list may consist of motion vectors with highfrequency, among motion vectors for the current picture reference mode.The range of motion vectors possibly included in the motion candidatelist may be determined on the basis of at least one among a search rangeof the reference block for the current picture reference mode andwhether wavefront parallel processing (WPP) is used. For example, therange of motion vectors possibly included in the motion candidate listmay be limited to the motion vectors within the region already decodedthrough WPP, or may be limited to the motion vectors within the searchrange of the reference block for the current picture reference mode.

Referring to FIG. 10, whether the current block is a block encoded inthe current picture reference mode may be determined at step S1000. Asdescribed above with reference to FIG. 9, the determination may beperformed on the basis of information indicating whether the currentblock is block encoded in the current picture reference mode, or may beperformed on the basis of the reference picture index of the currentblock.

When the current block is the block encoded in the current picturereference mode, whether the current picture to which the current blockbelongs is an IRAP picture is determined at step S1010.

When the current picture is the IRAP picture, the motion vector isderived on the basis of the above-described motion candidate list atstep S1020. In contrast, when the current picture is not the IRAPpicture, the motion vector is derived from the nearby block at stepS1030.

FIG. 11 is a diagram illustrating a method of filtering a referenceblock according to an embodiment of the present invention.

Referring to FIG. 11, a precision of the fraction pel with respect tofiltering of the reference block may be determined at step S1100.Examples of the precision of the fraction pel may include a ½ pel, a ¼pel, a ⅛ pel, a 1/16 pel, and the like. The precision of the fractionpel may be determined on the basis of information encoded to specify theprecision of the fraction pel with respect to the filtering.Alternatively, as the precision of the fraction pel, a precisionpre-established in the device for encoding/decoding the image may beused, and in this case, performance at step S1100 may be omitted.

Whether the filter used in filtering is the variable coefficient filtermay be determined at step S1110. This determination may be performed onthe basis of information indicating whether the variable coefficientfilter is used.

When the filter is the variable coefficient filter, the coefficient ofthe filter is checked at step S1120. The coefficient may be obtainedthrough a bitstream, or may be derived using the nearby sample.Alternatively, the coefficient may be derived from the filtercoefficient used before the current block. On the basis of thecoefficient obtained at step S1120, the reference block may be filteredat step S1130.

In contrast, when the filter is not the variable coefficient filter, thereference block is filtered on the basis of the fixed coefficient filterpre-established in the device for encoding/decoding the image at stepS1140.

In the meantime, the embodiment does not limit the temporal orderbetween a step of determining the precision of the fraction pel and astep of determining whether the variable coefficient filter is used. Thestep of determining the precision of the fraction pel may be performedafter the step of determining whether the variable coefficient filter isused, or these steps may be independently performed.

FIG. 12 is a diagram illustrating a shape of a current block encoded ina current picture reference mode according to an embodiment of thepresent invention.

Even when the current block is divided into squares or non-squares, thecurrent picture reference mode is used. Alternatively, as shown in FIG.12, even when the current block are divided in an arbitrary shape suchas a triangle, and the like, the current picture reference mode is used.

Referring to FIG. 12, blocks 1210 and 1230 are non-square blockssubjected to division, and blocks 1220 and 1240 are blocks subjected todivision in arbitrary shapes. The block 1230 may use the block 1210 as areference block, and the block 1240 may use the block 1220 as areference block. Here, a process of rotating the block 1220 by apredetermined angle may be involved.

Alternatively, by taking the size/shape of the current block, thecurrent picture reference mode may be used in a limited manner. Forexample, when the size of the current block is greater than a thresholdsize, the current picture reference mode is not allowed. Alternatively,when the division type of the current block is N×M, the current picturereference mode is not allowed. Here, the N and M are integers greaterthan zero and may be the same or different from each other. The N×M maybe pre-established in the device for encoding/decoding the image, or maybe derived on the basis of information encoded to indicate the blocksize/shape in which the current picture reference mode is allowed.

FIG. 13 is a diagram illustrating a process of intra prediction based oninterpolation according to an embodiment of the present invention.

Referring to FIG. 13, the nearby sample for intra prediction of thecurrent block may be specified at step S1300. The nearby sample maybelong to a block adjacent to the left, the bottom left, the top left,the top, or the top right of the current block. When there is still anon-reconstructed or reference-impossible sample among the nearbysamples, it is replaced by the pre-reconstructed sample or thereference-possible sample among the nearby samples.

The predetermined filtering may be performed on the specified nearbysample at step S1310. The filtering is a process of generating thefiltered nearby sample of an integer precision by applying apredetermined weighting factor to the nearby sample of an integerprecision. The filtering may be selectively performed on the basis ofthe intra prediction mode of the current block, the block size,variation in nearby samples adjacent to each other, and the like.

By applying the interpolation filter to the filtered nearby sample, thereference sample for intra prediction may be generated at step S1320.

Whether the interpolation filter is applied may be determined on thebasis of a flag encoded to indicate whether the interpolation filter isapplied. The flag may be signaled at least one level among a sequence, apicture, a slice, and a block. Alternatively, whether the interpolationfilter is applied may be determined by further taking the intraprediction mode of the current block into consideration. For example,when the intra prediction mode is a mode in which the sample of aninteger precision is referenced (for example, a planar mode, a DC mode,a horizontal mode, and a vertical mode), the interpolation filter is notapplied to the nearby sample.

Examples of the interpolation filter include a linear interpolationfilter, a cube interpolation filter, a Gaussian interpolation filter,and the like. The device for encoding/decoding the image may definemultiple interpolation filters, and one of these may be selectivelyused.

The interpolation filter may be determined by taking at least one of thesize and intra prediction mode of the current block into consideration.The current block may be the coding block (CU), the prediction block(PU), or the transform block (TU).

The block size may be expressed by the width/height of the block, thesum of the width and the height, the average value of the width and theheight, the number of samples belonging to the relevant block, and thelike.

For example, a first interpolation filter may be applied to a blocksmaller than a predetermined threshold size, and a second interpolationfilter may be applied to a block equal to or greater than the thresholdsize. The first and second interpolation filters are different from eachother in terms of at least one among the filter coefficient, the numberof taps, and the filter intensity. Alternatively, the firstinterpolation filter may be one of the types of described interpolationfilters, and the second interpolation filter may be another one. Thethreshold size may be preset in the device for encoding/decoding theimage, or may be variably determined by taking a specific encodingparameter into consideration. Alternatively, the same interpolationfilter may be applied to all block sizes, or different interpolationfilters may be applied to respective block sizes.

The intra prediction modes pre-defined in the device forencoding/decoding the image may be classified into multiple groups bytaking directionalities of the intra prediction modes intoconsideration. For example, the pre-defined intra prediction modes maybe classified into a first group with a first directionality, a secondgroup with a second directionality, a third group with a thirddirectionality, and the like. The number of groups may be in a range of1 to the number of pre-defined intra prediction modes. Each group mayconsist of one or more intra prediction modes. The multiple intraprediction modes belonging to each group may have similardirectionality. On the basis of directionality of the intra predictionmode, the interpolation filter may be determined.

Alternatively, the device for encoding the image may encode and signalinformation determining the interpolation filter, and the device fordecoding the image may determine the interpolation filter on the basisof the signaled information. The information may be signaled in at leastone of a sequence, a picture, a slice, and a block level.

The determination of the interpolation filter may mean determination ofat least one of the filter coefficient, the filter intensity, the numberof taps, and the type of the interpolation filter.

On the basis of the generated reference sample, intra prediction of thecurrent block may be performed at step S1330. For example, the referencesample may be set as a prediction sample of the current block. Thecurrent block may be reconstructed by adding the decoded residual sampleto the prediction sample. Alternatively, the reference sample may be setas a reconstruction sample of the current block. In this case, aresidual signal for the current block may not be signaled or may not bereconstructed.

FIG. 14 is a diagram illustrating a method of applying an interpolationfilter according to an embodiment of the present invention.

By applying the interpolation filter to multiple nearby samples adjacentto the current block, the reference sample for intra prediction may begenerated. The nearby sample may include at least one among the sampleof an integer precision and the sample of a fraction precision. Thenumber of nearby samples to which the interpolation filter is appliedmay be two, three, four, five, six, or more. The number of nearbysamples may be variably determined on the basis of at least one amongthe intra prediction mode of the current block and the position of thesample which is a prediction/reconstruction target within the currentblock. Alternatively, the number of nearby samples may be a fixed numberpre-established in the device for encoding/decoding the image. Theposition of the nearby sample may be determined on the basis of at leastone among the intra prediction mode of the current block and theposition of the sample which is the prediction/reconstruction targetwithin the current block.

Referring to FIG. 14, on the basis of the position of the sample whichis a prediction/reconstruction target within a current block 1410 andthe intra prediction mode of the current block, nearby samples 1431 1432with the integer precision may be specified. By interpolating the nearbysamples 1431 and 1432, a reference sample 1420 may be generated betweenthe nearby samples 1431 and 1432. Here, the reference sample 1420 may bea sample with a real number precision. The position of the referencesample may be specified on the basis of at least one among the positionof the sample which is the prediction/reconstruction target within thecurrent block 1410 and the intra prediction mode of the current block.

As shown in FIG. 14, the space between a P0 1431 and a P1 1432 which arenearby samples of the integer precision may be divided into multipleinterpolation sample positions. The interpolation sample positions mayhave the real number precision. The number of interpolation samplepositions is N, and the N may be an integer greater than one. On thebasis of the intra prediction mode of the current block, among theinterpolation sample positions, the position at which the referencesample is generated may be determined

For example, the space between the nearby samples P0 1431 and P1 1432may be divided into 32 interpolation sample positions with the realnumber precision. Here, the position of the reference sample 1420generated through interpolation is 13/32, and on the basis of thisposition, the interpolation filter is applied to the P0 1431 and P1 1432so that the reference sample is generated.

FIG. 15 is a diagram illustrating an example of an interpolation filterusing multiple taps according to an embodiment of the present invention.

In the present invention, the number of taps of the interpolation filtermay be determined on the basis of at least one among the size of thecurrent block, whether the intra prediction mode is the directionalmode, the directionality/angle of the intra prediction mode, and encodedinformation to specify the number of taps. The number of taps of theinterpolation filter may be two, three, four, five, six, or more.Hereinafter, for convenience of description, the cases where the numberof taps is four and six will be described respectively.

Referring to FIG. 15, on the basis of at least one among the position ofthe prediction/reconstruction target sample within the current block1510 and the intra prediction mode of the current block, a referencesample 1520 for intra prediction may be generated between at least twonearby samples among nearby samples 1531, 1532, 1533, and 1534 of theinteger precision. The two nearby samples may be nearby samples adjacentto each other or may be arranged in a discontinuous manner.

On the basis of at least one among the position of theprediction/reconstruction target sample within the current block 1510and the intra prediction mode of the current block, the four positionsof the nearby samples P0 1531, P1 1532, P2 1533, and P3 1534 with theinteger precision to which the interpolation filter is applied may bedetermined. Also, on the basis of at least one among the position of theprediction/reconstruction target sample within the current block 1510and the intra prediction mode of the current block, the position of thereference sample 1520 being interpolated may be determined between theP1 1532 and the P2 1533. The reference sample 1520 being interpolatedmay have the real number precision.

By applying the interpolation filter to the four nearby samples, thereference sample 1520 may be generated.

Referring to FIG. 15, on the basis of at least one among the position ofthe prediction/reconstruction target sample within the current block1540 and the intra prediction mode of the current block, a referencesample 1550 for intra prediction may be generated between at least twonearby samples among nearby samples 1561, 1562, 1563, 1564, 1565, and1566 of the integer precision. The two nearby samples may be nearbysamples adjacent to each other, or may be arranged in a discontinuousmanner.

On the basis of at least one among the position of theprediction/reconstruction target sample within the current block 1540and the intra prediction mode of the current block, the six positions ofthe nearby samples P0 1561, P1 1562, P2 1563, P3 1564, P4 1565, and P51566 with the integer precision to which the interpolation filter isapplied may be determined. Also, on the basis of at least one among theposition of the prediction/reconstruction target sample within thecurrent block 1540 and the intra prediction mode of the current block,the position of the reference sample 1550 being interpolated may bedetermined between the P2 1563 and the P3 1564. The reference sample1550 being interpolated may have the real number precision.

By applying the interpolation filter to the four nearby samples, thereference sample 1550 may be generated.

Although exemplary methods of the present invention are represented as aseries of operations for clarity of description, the order of the stepsis not limited thereto. When necessary, the illustrated steps may beperformed simultaneously or in a different order. In order to realizethe method according to the present invention, other steps may be addedto the illustrative steps, some steps may be excluded from theillustrative steps, or some steps may be excluded while additional stepsmay be included.

The various embodiments of the present invention are not intended tolist all possible combinations, but to illustrate representative aspectsof the present invention. The matters described in the variousembodiments may be applied independently or in a combination of two ormore.

Also, the various embodiments of the present invention may beimplemented by hardware, firmware, software, or a combination thereof.With hardware implementation, the embodiment may be implemented by usingat least one selected from a group of application specific integratedcircuits (ASICs), digital signal processors (DSPs), digital signalprocessing devices (DSPDs), programmable logic devices (PLDs), fieldprogrammable gate arrays (FPGAs), general-purpose processors,controllers, micro controllers, micro processors, etc.

The scope of the present invention includes software ormachine-executable instructions (e.g., an operating system, anapplication, firmware, a program, etc.) that cause operation accordingto the methods of the various embodiments to be performed on a device ora computer, and includes a non-transitory computer-readable mediumstoring such software or instructions to execute on a device or acomputer.

INDUSTRIAL APPLICABILITY

The present invention may be used in encoding/decoding a video signal.

1. An intra prediction method comprising: determining an intraprediction mode of a current block; determining a scanning order ofmultiple sub blocks in the current block on the basis of the determinedintra prediction mode; and performing intra prediction of the currentblock on the basis of the determined scanning order.
 2. An interprediction method comprising: deriving a motion vector of a currentblock; determining a reference block of the current block on the basisof the motion vector of the current block, the reference block belongingto the same picture as the current block; and performing motioncompensation of the current block on the basis of the determinedreference block.
 3. An intra prediction method comprising: specifying anearby sample for intra prediction of a current block; performingpredetermined filtering on the specified nearby sample; generating areference sample for the intra prediction by applying an interpolationfilter to the filtered nearby sample; and performing the intraprediction of the current block on the basis of the generated referencesample.
 4. A device for decoding an image, the device comprising: anintra prediction module configured to: determine an intra predictionmode of a current block; determine a scanning order of multiple subblocks in the current block on the basis of the determined intraprediction mode; and perform intra prediction of the current block onthe basis of the determined scanning order.
 5. A device for decoding animage, the device comprising: an inter prediction module configured to:derive a motion vector of a current block; determine a reference blockof the current block on the basis of the motion vector of the currentblock; and perform motion compensation of the current block on the basisof the determined reference block, wherein the reference block belongsto the same picture as the current block.
 6. A device for decoding animage, the device comprising: an intra prediction module configured to:specify a nearby sample for intra prediction of a current block; performpredetermined filtering on the specified nearby sample; generate areference sample for the intra prediction by applying an interpolationfilter on the filtered nearby sample; and perform the intra predictionof the current block on the basis of the generated reference sample.